package com.orangelife.mobile.myhouse.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;

import com.curry.android.util.IntentHelper;
import com.curry.orangelife.mobile.R;
import com.datatrack.DataTrack;
import com.orangelife.mobile.myhouse.activity.HouseListActivity;
import com.orangelife.mobile.myhouse.adapter.CertOklvAdapter;
import com.orangelife.mobile.myhouse.entity.IndustryEntity;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/6/27.
 */
public class IndustryFragment2 extends Fragment {

//    @Bind(R.id.rvIndustry)
//    YfListRecyclerView rvIndustry;
@Bind(R.id.rvIndustry)
ListView rvIndustry;
    private IndustryEntity mIb;
    @Bind(R.id.btnFinish)
    Button btnFinish;
    final  String MODULE_NAME="identityAuthenticationSuccess";
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.frgm_industry2, container, false);
        ButterKnife.bind(this, view);
        setAdapter();
        return view;
    }

    public void setData(IndustryEntity ib) {
        this.mIb = ib;
    }

//    private void setAdapter() {
//        if (mIb != null) {
//            List<IndustryEntity.ApartmentsBean> list = mIb.getApartments();
//            if (list.size() > 0) {
//                CertOkRvAdapter2 adapter = new CertOkRvAdapter2(list);
//                rvIndustry.setAdapter(adapter);
//            }
//        }
//    }

    private void setAdapter() {
        if (mIb != null) {
            List<IndustryEntity.ApartmentsBean> list = mIb.getApartments();
            if (list.size() > 0) {
                CertOklvAdapter adapter = new CertOklvAdapter(getActivity(),list);
                rvIndustry.setAdapter(adapter);
            }
        }
    }


    @OnClick(R.id.btnFinish)
    public void onClick() {
        getActivity().finish();
        DataTrack.clickTrack(DataTrack.APP_NAME,MODULE_NAME,"complete");
        IntentHelper.getInstances().getIntent(getActivity(), HouseListActivity.class);
    }
}